#encoding=utf-8

# coder : chenfeng@xyzq.com.cn
# date  : 2014-01-07

from django.shortcuts import render
from django.http import HttpResponse
from apps.utils.AjaxResponse import AjaxResponse
from ..models.Environment import EnvironmentModel
import json

class Environment:
	@staticmethod
	def new(request):
		data = {
				'name': request.GET['name'], \
				'desp': request.GET['desp'], \
				'envNum': unicode(request.GET['envNum']) \
               }
		resp = AjaxResponse(data=data)
		return HttpResponse(resp.toJsonStr())

	@staticmethod
	def index(request):
		if request.session.has_key('ttt'):
			returnStr = 'index session %s' % request.session['ttt']
			del request.session['ttt']
			return HttpResponse(returnStr)
		else:
			request.session['ttt'] = 'kkk'
			return HttpResponse('index %s' % request)
